//
//  DDSoundDetalisTableViewCell2.m
//  ialone
//
//  Created by lanou on 16/1/13.
//  Copyright © 2016年 JasperSong. All rights reserved.
//

#import "DDSoundDetalisTableViewCell2.h"
#import "UIButton+WebCache.h"
@implementation DDSoundDetalisTableViewCell2



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubviews];
    }
    return self;
}



- (void)addSubviews
{
    // 喜欢
    self.like = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 60, 40)];
    self.like.text = @"喜欢";
  //  self.like.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.like];
    
    // 人数
    self.peoples = [[UILabel alloc] initWithFrame:CGRectMake(self.like.frame.origin.x + self.like.frame.size.width + 10, self.like.frame.origin.y + self.like.frame.size.height - 20, 100, 20)];
  //  self.peoples.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.peoples];
    //
    // 直线
    self.lineImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.like.frame.origin.x, self.like.frame.origin.y + self.like.frame.size.height + 20, kScreenWidth - self.like.frame.origin.x * 2, 1)];
    self.lineImageView.backgroundColor = [UIColor brownColor];
    [self.contentView addSubview:self.lineImageView];
    
    // 喜欢按钮
    self.likeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.likeButton.frame = CGRectMake(self.lineImageView.frame.origin.x, self.lineImageView.frame.size.height + self.lineImageView.frame.origin.y + 20, 80, 40);
    [self.likeButton setImage:[UIImage imageNamed:@"dadexihuan"] forState:(UIControlStateNormal)];
   // self.likeButton.backgroundColor = [UIColor greenColor];
    [self.contentView addSubview:self.likeButton];
    //
    // 头像
    // 1
    self.touXiang1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang1.frame = CGRectMake(self.likeButton.frame.origin.x + self.likeButton.frame.size.width + 10, self.likeButton.frame.origin.y, self.likeButton.frame.size.height, self.likeButton.frame.size.height);
    self.touXiang1.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang1.layer.masksToBounds = YES;
    
  //  self.touXiang1.backgroundColor = [UIColor grayColor];
    
    [self.contentView addSubview:self.touXiang1];
    // 2
    self.touXiang2 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang2.frame = CGRectMake(self.touXiang1.frame.origin.x + self.touXiang1.frame.size.width + 5, self.touXiang1.frame.origin.y, self.touXiang1.frame.size.height, self.touXiang1.frame.size.height);
    self.touXiang2.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang2.layer.masksToBounds = YES;
 //   self.touXiang2.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang2];
    // 3
    self.touXiang3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang3.frame = CGRectMake(self.touXiang2.frame.origin.x + self.touXiang2.frame.size.width + 5, self.touXiang2.frame.origin.y, self.touXiang2.frame.size.height, self.touXiang2.frame.size.height);
    self.touXiang3.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang3.layer.masksToBounds = YES;
 //   self.touXiang3.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang3];
    // 4
    self.touXiang4 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang4.frame = CGRectMake(self.touXiang3.frame.origin.x + self.touXiang3.frame.size.width + 5, self.touXiang3.frame.origin.y, self.touXiang3.frame.size.height, self.touXiang3.frame.size.height);
    self.touXiang4.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang4.layer.masksToBounds = YES;
   // self.touXiang4.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang4];
    // 5
    self.touXiang5 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang5.frame = CGRectMake(self.touXiang4.frame.origin.x + self.touXiang4.frame.size.width + 5, self.touXiang4.frame.origin.y, self.touXiang4.frame.size.height, self.touXiang4.frame.size.height);
    self.touXiang5.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang5.layer.masksToBounds = YES;
  //  self.touXiang5.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang5];
    // 6
    self.touXiang6 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang6.frame = CGRectMake(self.touXiang5.frame.origin.x + self.touXiang5.frame.size.width + 5, self.touXiang5.frame.origin.y, self.touXiang5.frame.size.height, self.touXiang5.frame.size.height);
    self.touXiang6.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang6.layer.masksToBounds = YES;
   // self.touXiang6.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang6];
    // // 7
    self.touXiang7 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang7.frame = CGRectMake(self.touXiang1.frame.origin.x, self.touXiang1.frame.origin.y + self.touXiang1.frame.size.height + 5, self.touXiang1.frame.size.height, self.touXiang1.frame.size.height);
    self.touXiang7.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang7.layer.masksToBounds = YES;
  //  self.touXiang7.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.touXiang7];
    //  // 8
    self.touXiang8 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang8.frame = CGRectMake(self.touXiang7.frame.origin.x + self.touXiang7.frame.size.width + 5, self.touXiang7.frame.origin.y, self.touXiang7.frame.size.height, self.touXiang7.frame.size.height);
    self.touXiang8.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang8.layer.masksToBounds = YES;
  //  self.touXiang8.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang8];
    //  // 9
    self.touXiang9 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang9.frame = CGRectMake(self.touXiang8.frame.origin.x + self.touXiang8.frame.size.width + 5, self.touXiang8.frame.origin.y, self.touXiang8.frame.size.height, self.touXiang8.frame.size.height);
    self.touXiang9.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang9.layer.masksToBounds = YES;
  //  self.touXiang9.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang9];
    // 10
    self.touXiang10 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang10.frame = CGRectMake(self.touXiang9.frame.origin.x + self.touXiang9.frame.size.width + 5, self.touXiang9.frame.origin.y, self.touXiang9.frame.size.height, self.touXiang9.frame.size.height);
    self.touXiang10.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang10.layer.masksToBounds = YES;
  //  self.touXiang10.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang10];
    // 11
    self.touXiang11 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang11.frame = CGRectMake(self.touXiang10.frame.origin.x + self.touXiang10.frame.size.width + 5, self.touXiang10.frame.origin.y, self.touXiang10.frame.size.height, self.touXiang10.frame.size.height);
    self.touXiang11.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang11.layer.masksToBounds = YES;
 //   self.touXiang11.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang11];
    // 12
    self.touXiang12 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.touXiang12.frame = CGRectMake(self.touXiang11.frame.origin.x + self.touXiang11.frame.size.width + 5, self.touXiang11.frame.origin.y, self.touXiang11.frame.size.height, self.touXiang11.frame.size.height);
    self.touXiang12.layer.cornerRadius = self.likeButton.frame.size.height / 2;
    self.touXiang12.layer.masksToBounds = YES;
  // self.touXiang12.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.touXiang12];
    
    
    self.hot = [[UILabel alloc] initWithFrame:CGRectMake(self.likeButton.frame.origin.x, self.touXiang7.frame.origin.y + self.touXiang7.frame.size.height + 20, 120, 40)];
    self.hot.text = @"最热评论";
   // self.hot.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.hot];
    
    self.lineHotImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.hot.frame.origin.x, self.hot.frame.origin.y + self.hot.frame.size.height + 20, kScreenWidth - self.like.frame.origin.x * 2, 1)];
    self.lineHotImageView.backgroundColor = [UIColor brownColor];
    [self.contentView addSubview:self.lineHotImageView];
    
}





- (void)setModel:(DDSoundDetalisModel *)model
{
    _model = model;
    [self.touXiang1 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[0][@"avatar"]] forState:(UIControlStateNormal)];
    
    [self.touXiang2 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[1][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang3 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[2][@"avatar"]] forState:(UIControlStateNormal)];

    [self.touXiang4 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[3][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang5 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[4][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang6 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[5][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang7 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[6][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang8 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[7][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang9 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[8][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang10 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[9][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang11 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[10][@"avatar"]] forState:(UIControlStateNormal)];
    [self.touXiang12 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[11][@"avatar"]] forState:(UIControlStateNormal)];
   
    
}




//- (void)setModel:(DDSoundDetalisModel2 *)model
//{
//    
//    _model = model;
//    [self.touXiang1 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[0][@"avatar"]] forState:(UIControlStateNormal)];
//    
//    [self.touXiang2 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[1][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang3 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[2][@"avatar"]] forState:(UIControlStateNormal)];
//    
//    [self.touXiang4 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[3][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang5 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[4][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang6 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[5][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang7 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[6][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang8 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[7][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang9 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[8][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang10 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[9][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang11 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[10][@"avatar"]] forState:(UIControlStateNormal)];
//    [self.touXiang12 sd_setBackgroundImageWithURL:[NSURL URLWithString:model.digg[11][@"avatar"]] forState:(UIControlStateNormal)];
//    
//
//}
//
//


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
